//
//  TotalLotteryTypeView.m
//  WanCaiC8
//
//  Created by QiuXun on 2019/1/12.
//  Copyright © 2019 tangang. All rights reserved.
//

#import "TotalLotteryTypeView.h"

#import "LotteryTopView.h"
#import "HomePageVM.h"

@interface TotalLotteryTypeView()<UICollectionViewDelegate,UICollectionViewDataSource>

@property(nonatomic,strong)LotteryTopView *lotteryTopView;
@property(nonatomic,strong)UICollectionView *collectionView;

@end
@implementation TotalLotteryTypeView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self setupUI];
        
        [self getLotteryInfoWithId:@"5"];
    }
    return self;
}


/**
 获取六合彩的开奖信息
 
 @param lType 六合彩的ltype
 */
- (void)getLotteryInfoWithId:(NSString *)lType{
    WS(weakSelf);
    [[HomePageVM manage] getLotteryInfoWithId:lType Success:^(id returnValue) {
        
        [weakSelf.lotteryTopView setLotteryModel:returnValue];
        
    } andFail:^(NSString *errorMessage, NSError *error) {
        
    }];
    
}


-(void)setupUI{
    
    
    self.lotteryTopView=[[LotteryTopView alloc] init];
    [self addSubview:self.lotteryTopView];
    [self.lotteryTopView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self).offset(5);
        make.left.equalTo(self).offset(10);
        make.right.equalTo(self).offset(-10);
        make.height.mas_equalTo(@(real_size(150)));
    }];
    
    [self.lotteryTopView layoutIfNeeded];
    
    self.lotteryTopView.layer.cornerRadius = 10;
    self.lotteryTopView.layer.masksToBounds = YES;
    
}
@end
